<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>111</title>
</head>

<body>
    <script>
        /* Object.defineProperty(window, 'age', {
            value: 15
        }) */
        Object.defineProperty(Object, 'freezepolyfill', {
            value: function (obj) {
                var i
                for (i in obj) {
                    if (obj.hasOwnProperty(i)) {
                        if (obj[i] instanceof Object) {
                            Object.freezepolyfill(obj[i])
                        } else {
                            Object.defineProperty(obj, i, {
                                writable: false
                            })
                        }
                    }
                }
                Object.seal(obj)
            }
        })
        const student = {
            name: 'xiaoming',
            age: 16,
            obj: {
                a: 1
            }
        }
        Object.freezepolyfill(student)
    </script>
</body>

</html>